<template>
  <el-dialog
    title="设置撤回节点"
    :visible.sync="dialogVisible"
    destroy-on-close
    width="1024px">
    <div>
      <el-radio-group v-model="checkData">
        <el-radio  v-for="item in userTaskNodeList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
      </el-radio-group>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="confirm">确 定</el-button>
    </span>
  </el-dialog>

</template>
<script>

    import Const from './Const'
    export default {
        components:{

        },
      inject: ['elementRegistry'],
        props: {
            value: {
                type: Object,
                default() {
                    return ''
                }
            }
        },
        data() {
            return {
                checkData:'',
                dialogVisible: false,
            }
        },
        computed: {
          userTaskNodeList(){
            const list = []
            const items = this.elementRegistry()._elements
            for (const item in items){
              if(items[item].element.type==='bpmn:UserTask'){
                list.push(items[item].element.businessObject)
              }
            }
            return list
          },
        },
        watch: {

        },
        methods: {
          confirm() {
            this.$emit('input', {
              ...this.value,
              pointNode:this.checkData
            })
            this.dialogVisible = false
          },
            open() {
               this.dialogVisible = true
            }
        },
        created() {
          let pointNode = this.value.pointNode
          if(!pointNode){
            pointNode = []
            this.$emit('input', {
              ...this.value,
              pointNode
            })
          }
          this.checkData = pointNode
        },
        mounted() {

        },
    }
</script>
<style>

</style>
